package com.lab.service.impl;

import com.lab.dao.LabDao;
import com.lab.pojo.Lab;
import com.lab.service.LabService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("labService")
public class LabServiceImp implements LabService {
    @Resource
    LabDao labDao;
    public List<Lab> allLabs() {
        return labDao.allLabs();
    }

    public void saveLab(Lab lab) {
        if (lab.getLab_id()!=null){
            //修改
            labDao.updateLab(lab);
        }else {
            //增加
            labDao.addLab(lab);
        }
    }

    public void deleteLab(Long[] lab_id) {
        labDao.deleteLab(lab_id);
    }

    public Lab findLabById(Lab lab_id) {
        return labDao.findLabById(lab_id);
    }

    public List<Lab> findLab() {
        return labDao.findLab();
    }
}
